package cn.xej.boot_redis01.service.impl;

import cn.xej.boot_redis01.mapper.TbUserMapper;
import cn.xej.boot_redis01.pojo.TbUser;
import cn.xej.boot_redis01.service.TbUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)   // 方法抛出异常，就会回滚，数据库里的数据也会回滚。
public class TbUserServiceImpl implements TbUserService {

    @Resource
    private TbUserMapper tbUserMapper;


    @Override
    public List<TbUser> users() {
        List<TbUser> users = tbUserMapper.getUsers();
        return users;
    }
}
